import {
  getCity,
  getAdcode,
  getWeatherToday,
  getWeatherFuture,
} from "@/api/index"
import { ref, computed, onMounted, watch } from "vue"
import { defineStore } from "pinia"

export const counter = defineStore("weatherStore", () => {
  const getIpWeather = async () => {
    const res = await getCity()
    console.log(res)
    const localCityAdcode = ref("")
    const localCityWeather = ref("")

    localCityAdcode.value = res.adcode
    const data = (await getWeatherToday(localCityAdcode.value)).lives[0]
    console.log(data)
    localCityWeather.value = data
  }
  return {
    getIpWeather,
  }
})
